﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.Core.Modelling.Primitives;

namespace ITAP.ContourBuilder.Components.Dimensions
{
    [Serializable]
    public class DirectDistanceDimension : ComponentLeaderDimension
    {
        public override void Recalculate()
        {
            this.Primitive = new Line(this.Component1.Position, this.Component2.Position);
        }

        public override string DimensionText
        {
            get
            {
                if (this.PrefixSymbol != String.Empty)
                    return this.PrefixSymbol + " = " + this.Primitive.Length.ToString("0.0");
                else
                    return this.Primitive.Length.ToString("0.0");
            }
        }

        public override void AcceptDimensionVisitor(IDimensionVisitor visitor)
        {
            visitor.Visit(this);
        }
    }
}
